//------------------------------------------------
//		ENCODER.c
//	Arthur Benemann 25/05/2012
//------------------------------------------------
//	Description:
//-----------------------------------------------
//	Requeriments:
//	2 Remapable pin 
//-----------------------------------------------
//FIXME
//-----------------------------------------------

#include "UART/UART2.h"
#include "picDev.h"

char aOld, bOld;
int encoderPos;


int processEncoder(){
    char a, b;
    a = encoderP1;
    b = encoderP2;

    if ((a != aOld)) {
        if (a^b) {
            encoderPos--;
        } else {
            encoderPos++;
        }
    }
    if ((b != bOld)) {
        if (a^b) {
            encoderPos++;
        } else {
            encoderPos--;
        }
    }
    bOld = b;
    aOld = a;
}



